From bfd12bf9c5f227d1f480b926a8ca101dd1e9e6ee Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sun, 6 Nov 2005 16:40:15 +0100 Subject: [PATCH] Added domain_ioport_permission to the python module xen.lowlevel.xc, wrapping the equivalent libxc call Signed-off-by: Jody Belka --- tools/python/xen/lowlevel/xc/xc.c | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index b01f3645a3..f7a00037e9 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -858,6 +858,29 @@ static PyObject *pyxc_domain_memory_increase_reservation(PyObject *self, return zero; } +static PyObject *pyxc_domain_ioport_permission(PyObject *self, + PyObject *args, + PyObject *kwds) +{ + XcObject *xc = (XcObject *)self; + uint32_t dom; + int first_port, nr_ports, allow_access, ret; + + static char *kwd_list[] = { "dom", "first_port", "nr_ports", "allow_access", NULL }; + + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiii", kwd_list, + &dom, &first_port, &nr_ports, &allow_access) ) + return NULL; + + ret = xc_domain_ioport_permission( + xc->xc_handle, dom, first_port, nr_ports, allow_access); + if ( ret != 0 ) + return PyErr_SetFromErrno(xc_error); + + Py_INCREF(zero); + return zero; +} + static PyMethodDef pyxc_methods[] = { { "handle", (PyCFunction)pyxc_handle, @@ -1127,6 +1150,16 @@ static PyMethodDef pyxc_methods[] = { " mem_kb [long]: .\n" "Returns: [int] 0 on success; -1 on error.\n" }, + { "domain_ioport_permission", + (PyCFunction)pyxc_domain_ioport_permission, + METH_VARARGS | METH_KEYWORDS, "\n" + "Allow a domain access to a range of IO ports\n" + " dom [int]: Identifier of domain to be allowed access.\n" + " first_port [int]: First IO port\n" + " nr_ports [int]: Number of IO ports\n" + " allow_access [int]: Non-zero means enable access; else disable access\n\n" + "Returns: [int] 0 on success; -1 on error.\n" }, + { NULL, NULL, 0, NULL } }; -- 2.30.2